export default {
	state:{
		token:uni.getStorageSync('token') || '',
		userinfo: JSON.parse(uni.getStorageSync('userinfo')||'{}'),
		Router:null
	},
	mutations:{
		//保存本地
		getusofbd(state){
			uni.setStorageSync('userinfo',JSON.stringify(state.userinfo))
		},
		//保存用户信息
		getaddlogin(state,obj){
			state.userinfo = obj.userInfo
			//保存至本地
			this.commit('getusofbd')
		},
		//保存token
		getlogintoken(state,token){
			state.token = token
			//存本地
			this.commit('getaddtoken')
		},
		//token存本地
		getaddtoken(state){
			uni.setStorageSync('token',state.token)
		},
		//退出登录
		addtuiclogin(state){
			state.token = ''
			state.userinfo = {}
			this.commit('getaddtoken')
			this.commit('getusofbd')
			uni.showToast({
				title:'已退出登录',
				icon:'success'
			})
		},
		//保存上个页面信息
		addrouters(state,obj){
			state.Router = obj
		},
		//跳转完成把上次保留的页面路径对象清空,以防下次跳转跳到该路径
		dieltrouets(state){
			state.Router = null
		}
	},
	actions:{},
	getters:{}
}